#include<stdio.h>

int main() {
    int n, i, j, k, m;
    bool flag;
    char a[3][7], b[3][7], c[3][5];
    scanf("%d", &n);
    while(n--)
    {
	for (i = 0; i < 3; i++) {
	    scanf("%s %s %s", a[i], b[i], c[i]);
	}
	for (flag = i = 0; i < 12 && !flag; i++){
	    for (j = 0; j < 2 && !flag; j++) {
		for (flag = 1, k = 0; k < 3 && flag; k++) {
		    for (m = 0; a[k][m] && flag; m++){
			if(a[k][m] == i + 'A') {
			    if ((j == 0 && c[k][0] != 'd') || (j == 1 && c[k][0] != 'u')){
				flag = false;
			    }
			    break;
			} else if (b[k][m] == i + 'A') {
			    if ((j == 0 && c[k][0] != 'u') || (j == 1 && c[k][0] != 'd')){
				flag = false;
			    }
			    break;
			}
		    }
		    if (flag && !a[k][m] && c[k][0] != 'e') flag = false;
		}
	    }
	}
	printf("%c is the counterfeit coin and it is ", (i - 1 + 'A'));
	j == 1 ? printf("light.\n") : printf("heavy.\n");
    }
    return 0;
}
